package com.huawei.appmarket.framework.titleframe.title;

import android.app.ActionBar;
import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.BaseTitleBean;
import java.lang.ref.WeakReference;
import o.azb;
import o.cgv;
import o.cjf;
import o.dky.d;
import o.dky.h;
import o.dky.i;
import o.dky.j;
import o.ActivityUtil;

public class DefaultTitle extends cjf {
    private ActionBar ˏ;
    private TextView ॱॱ;

    static class a implements OnClickListener {
        private WeakReference<Activity> ˏ;

        public a(Activity activity) {
            this.ˏ = new WeakReference(activity);
        }

        public void onClick(View view) {
            if (this.ˏ != null) {
                Activity activity = (Activity) this.ˏ.get();
                if (!ActivityUtil.isAcitivtyNotValid(activity)) {
                    activity.finish();
                }
            }
        }
    }

    public DefaultTitle(Activity activity, BaseTitleBean baseTitleBean) {
        super(activity, baseTitleBean);
    }

    public View ʽ() {
        if (this.ˊ == null || this.ˋ == null || this.ˎ == null) {
            return null;
        }
        CharSequence ˋ;
        this.ˏ = this.ˋ.getActionBar();
        String string = this.ˋ.getString(j.ʼ);
        if (TextUtils.isEmpty(this.ˎ.ˋ())) {
            Object obj = string;
        } else {
            ˋ = this.ˎ.ˋ();
        }
        cgv.ˋ(this.ˋ, d.ॱ, d.ˏॱ);
        if (this.ˏ != null) {
            this.ˏ.hide();
        }
        View inflate = this.ˊ.inflate(i.ˏॱ, null);
        View findViewById = inflate.findViewById(h.ʼॱ);
        azb.ˏ(findViewById);
        View findViewById2 = findViewById.findViewById(h.ˌ);
        this.ॱॱ = (TextView) findViewById.findViewById(h.ॱˑ);
        this.ॱॱ.setText(ˋ);
        findViewById2.setOnClickListener(new a(this.ˋ));
        return inflate;
    }

    public void ʻ() {
        if (this.ˎ != null) {
            CharSequence string = this.ˋ.getString(j.ʼ);
            if (!TextUtils.isEmpty(this.ˎ.ˋ())) {
                string = this.ˎ.ˋ();
            }
            if (this.ॱॱ != null) {
                this.ॱॱ.setText(string);
            }
        }
    }

    public String ᐝ() {
        return "default_title";
    }
}
